<?php

//cli运行环境
if (php_sapi_name() !== 'cli') {
    return false;
}

if($argc > 0) {
    $_SERVER['REQUEST_URI'] = $argv[1];
    $_SERVER['QUERY_STRING'] = '';
    
    $cliParams = function () use($argc, $argv) {
        if($argc > 2) {
            $params = array();
            for($i = 2; $i < count($argv); $i++) {
                $params[] = $argv[$i];
            }
            
            return $params;
        }

        return false;
    };
}

chdir(dirname(__FILE__));

defined('ENV') || define('ENV', 'local');

date_default_timezone_set('Asia/Shanghai');

//加载自动导入系统
require './baseVendor/core/autoload/initAutoload.php';
//加载第三方库自动导入系统
require './vendor/autoload.php';

//进行分发
\core\init\init::loadControllerAndAction();